package com.eclipse.e0112_io.bz案例;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class d复制文件 {

	public static void main(String[] args) throws Exception {

//		Path path = Paths.get("/Users/liuzhuangzhuang/Desktop/test1.txt");

//		Files.readAllLines(path); //一次性读取全部内容

		FileInputStream fis = new FileInputStream("/Users/liuzhuangzhuang/test/a.txt");

		FileOutputStream fos = new FileOutputStream("/Users/liuzhuangzhuang/test/c.txt");

		int result = 0;
		while (result != -1) {
			result = fis.read();//每次读一个字节
			if (result != -1) {//如果字节不等于-1 write写入文件
				fos.write(result);
			}
		}
		fis.close();
		fos.close();
	}
}
